<template>
  <div :class="[`nav-theme-${navTheme}`, `nav-layout-${navLayout}`]">
    <a-layout id="components-layout-demo-side" style="min-height: 100vh">
      <a-layout-sider
        v-if="navLayout === 'left'"
        v-model="collapsed"
        collapsible
        :trigger="null"
        :theme="navTheme"
        width="256px"
      >
        <div class="logo">
          <img :src="logo" alt="" class="logo_img" />
          <h1>Ant Dsign Vue Pro</h1>
        </div>
        <slider-menu :theme="navTheme" :collapsed="collapsed" />
      </a-layout-sider>
      <a-layout>
        <a-layout-header style="background: #fff; padding: 0">
          <a-icon
            :type="collapsed ? 'menu-unfold' : 'menu-fold'"
            class="trigger"
            @click="collapsed = !collapsed"
            v-auth="['admin']"
          ></a-icon>
          <Header />
        </a-layout-header>
        <a-layout-content style="margin: 0 16px">
          <router-view></router-view>
        </a-layout-content>
        <a-layout-footer style="text-align: center">
          <Footer />
        </a-layout-footer>
      </a-layout>
    </a-layout>
    <Authorized :authority="['admin']">
      <setting-drawer />
    </Authorized>
  </div>
</template>

<script>
import Footer from "./Footer.vue";
import Header from "./Header.vue";
import SliderMenu from "./SliderMenu.vue";
import SettingDrawer from "../components/SettingDrawer";
// import Authorized from "../components/Authorized.vue";
import logo from "@/assets/logo.png";
export default {
  props: {},
  data() {
    return {
      collapsed: false,
      logo,
    };
  },
  components: { Header, SliderMenu, Footer, SettingDrawer },
  computed: {
    navTheme() {
      return this.$route.query.navTheme || "dark";
    },
    navLayout() {
      return this.$route.query.navLayout || "left";
    },
  },
};
</script>

<style scoped >
.trigger {
  font-size: 20px;
  line-height: 64px;
  padding: 0 20px;
  background-color: #eee;
}
.logo {
  height: 64px;
  line-height: 64px;
  text-align: center;
  overflow: hidden;
}
.logo h1 {
  display: inline-block;
  margin: 0 0 0 12px;
  font-size: 20px;
  font-family: Avenir, "Helvetica Neue", Arial, Helvetica, sans-serif;
  font-weight: 600;
  vertical-align: middle;
  color: #eee;
}
.logo_img {
  width: 40px;
  height: auto;
}
.ant-layout-sider {
  overflow: hidden;
}

/* .ant-layout-sider >>> .ant-menu-dark .ant-menu-item-selected {
  color: black;
}
.ant-layout-sider >>> .ant-menu-dark .ant-menu-item-selected .anticon + span {
  color: black;
} */
</style>
